package com.easy;

/**
 * Created by Lxk on 2019/6/16.
 */
public class Solution961 {

    public int repeatedNTimes(int[] A) {
        for(int i = 0;i < A.length-2; i++){
            if(A[i]==A[i+1] || A[i] == A[i+2]){
                return A[i];
            }
        }
        return A[A.length-2]==A[A.length-1] ? A[A.length-2] : A[0];
    }





    public static void main(String[] args) {
        int[] A = {1,2,3,3};
        Solution961 solution961 = new Solution961();
        System.out.println(solution961.repeatedNTimes(A));
    }

}
